package com.banciyuan.bcywebview.utils.http;

import android.content.Context;
import android.text.TextUtils;

import com.android.volley.Request.Method;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.banciyuan.bcywebview.api.AskApi;
import com.banciyuan.bcywebview.api.CoserApi;
import com.banciyuan.bcywebview.api.DailyApi;
import com.banciyuan.bcywebview.api.GroupApi;
import com.banciyuan.bcywebview.api.IllustApi;
import com.banciyuan.bcywebview.api.MessageApi;
import com.banciyuan.bcywebview.api.NovelApi;
import com.banciyuan.bcywebview.api.TimelineApi;
import com.banciyuan.bcywebview.api.UserApi;
import com.banciyuan.bcywebview.api.ZhipinApi;
import com.banciyuan.bcywebview.base.factory.TimelineFactory;
import com.banciyuan.bcywebview.base.helper.data.UserDataHelper;
import com.banciyuan.bcywebview.utils.sns.SnsMemory;
import com.banciyuan.bcywebview.utils.string.StringUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import de.greenrobot.daoexample.model.Complex;
import de.greenrobot.daoexample.model.DetailType;
import de.greenrobot.daoexample.model.Timeline;


//网络请求的最后一步，主要是为了减少helper里的代码量。所以这个类比较繁杂，可以不用修改，什么时候要添加直接添加新的
public class CommonApiUtils {

    public static Boolean getAnswer(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                    Response.ErrorListener onError, int pagenum, String token) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.INDEX_P, "" + pagenum));
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                AskApi.getAnswer(), mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getAnswer(), map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean delAsk(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                 Response.ErrorListener onError, String ua_id, String token) {

        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.UAID, ua_id));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getDelask(), map, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doAsk(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                Response.ErrorListener onError, String ouid, String token, Boolean anonymous, String content) {

        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.OUID, ouid));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        if (anonymous) paramsList.add(new BcyPair(HttpUtils.ASK_ANONYMOUS, "1"));
        else paramsList.add(new BcyPair(HttpUtils.ASK_ANONYMOUS, "0"));
        paramsList.add(new BcyPair(HttpUtils.DAILY_CONTENT, content));
        Map<String, String> map = HttpUtils.getData(paramsList);

        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getDoask(), map, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doAnswer(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                   Response.ErrorListener onError, String ua_id, String token, String content) {

        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.UAID, ua_id));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.DAILY_CONTENT, content));
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getDoanswer(), map, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doAskDing(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                    Response.ErrorListener onError, String ua_id, String token) {
        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.UAID, ua_id));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getDoding(), map, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doAskTuijian(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                       Response.ErrorListener onError, String ua_id, String token) {
        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.UAID, ua_id));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);

        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getDotuijian(), map, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean getAskList(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                     Response.ErrorListener onError, int pagenum, String ouid) {
        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.OUID, ouid));
        paramsList.add(new BcyPair(HttpUtils.INDEX_P, "" + pagenum));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                AskApi.getListask(), mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getListask(), map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean getAskHeaderInfo(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                           Response.ErrorListener onError, String token, String ouid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.OUID, ouid));
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                AskApi.getIndex(), mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                AskApi.getIndex(), map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean getMessageTipsData(Context mContext, RequestQueue mQueue, Response.Listener<String> onSuccess,
                                             Response.ErrorListener onError, int pagenum, String token, String action) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.INDEX_P, "" + pagenum));
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL + action, mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL + action,
                map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doLoginAction(Context mContext, RequestQueue mQueue,
                                        Response.Listener<String> onSuccess, Response.ErrorListener onError, String name, String pwd) {

        List<BcyPair> paramsList = new ArrayList<>();
        paramsList.add(new BcyPair(HttpUtils.LOGIN_PARAM_USER, name));
        paramsList.add(new BcyPair(HttpUtils.LOGIN_PARAM_PASS, pwd));
        HashMap<String, String> params = HttpUtils.getData(paramsList);

        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                UserApi.getLogin(), params, onSuccess, onError);
        mQueue.add(getUserdataRequest);

        return true;
    }

    public static Boolean doPhoneRegisterAction(Context mContext, RequestQueue mQueue,
                                                Response.Listener<String> onSuccess, Response.ErrorListener onError, String phone, String pwd, String nickname
            , String code, boolean ifSina, boolean ifQQ, String sinaName, String qqName) {
        try {
            List<BcyPair> paramsList = new ArrayList<>();
            paramsList.add(new BcyPair(HttpUtils.MOBILE, phone));
            paramsList.add(new BcyPair(HttpUtils.REGISTER_PARAM_PASS, pwd));
            paramsList.add(new BcyPair(HttpUtils.REGISTER_PARAM_NICKNAME, nickname));
            paramsList.add(new BcyPair(HttpUtils.CODE, code));
            if (ifSina) {
                paramsList.add(new BcyPair(HttpUtils.SINA_PARAM_UID, SnsMemory.mAccessToken.getUid()));
                paramsList.add(new BcyPair(HttpUtils.SINA_PARAM_TOKEN, SnsMemory.mAccessToken.getToken()));
                paramsList.add(new BcyPair(HttpUtils.SINA_PARAM_ETIME,
                        "" + SnsMemory.mAccessToken.getExpiresTime()));
                if (!TextUtils.isEmpty(sinaName))
                    paramsList.add(new BcyPair(HttpUtils.REGISTER_PARAM_SINANAME, sinaName));
            } else if (ifQQ) {
                paramsList.add(new BcyPair(HttpUtils.QQ_PARAM_UID, SnsMemory.mQQMsg.unid));
                paramsList.add(new BcyPair(HttpUtils.QQ_PARAM_TOKEN, SnsMemory.mQQMsg.qqToken));
                paramsList.add(new BcyPair(HttpUtils.QQ_PARAM_ETIME, SnsMemory.mQQMsg.expires));
                if (!TextUtils.isEmpty(qqName))
                    paramsList.add(new BcyPair(HttpUtils.QQ_PARAM_NAME, qqName));
            }
            Map<String, String> map = HttpUtils.getData(paramsList);
            StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                    UserApi.registerMobilePhone(), map, onSuccess, onError);
            mQueue.add(getUserdataRequest);
            return true;
        } catch (Exception e) {
            return false;
        }
    }


    public static Boolean getGroundFrontData(Context mContext, RequestQueue mQueue,
                                             Response.Listener<String> onSuccess, Response.ErrorListener onError,
                                             String uid, String token, String cardType, String groundType, String filter) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(token)) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, token));
        }
        if (StringUtil.notNullEndWith(cardType, HttpUtils.UPPULL_TYPE_USER)) {
            paramsList.add(new BcyPair(HttpUtils.UID, uid));
        }
        paramsList.add(new BcyPair(HttpUtils.UPPULL_SOURCE, groundType));
        paramsList.add(new BcyPair(HttpUtils.TYPE, cardType));
        if (!TextUtils.isEmpty(filter)) paramsList.add(new BcyPair("filter", filter));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                TimelineApi.getLatest(), mContext, params);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                TimelineApi.getLatest(), params, onSuccess, errorProxy);
        mQueue.add(getFrontRequest);
        return true;
    }

    public static Boolean getGroundLastData(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError,
                                            String uid, String token, String cardType, String groundType, String since, String filter) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(token)) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, token));
        }
        if (StringUtil.notNullEndWith(cardType, HttpUtils.UPPULL_TYPE_USER)) {
            paramsList.add(new BcyPair(HttpUtils.UID, uid));
        }
        paramsList.add(new BcyPair(HttpUtils.UPPULL_SINCE, since));
        paramsList.add(new BcyPair(HttpUtils.UPPULL_SOURCE, groundType));
        if (!TextUtils.isEmpty(filter)) paramsList.add(new BcyPair("filter", filter));
        paramsList.add(new BcyPair(HttpUtils.TYPE, cardType));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                TimelineApi.getMore(), mContext, params);
        StringRequestParam getLastRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                TimelineApi.getMore(), params, onSuccess, errorProxy);
        mQueue.add(getLastRequest);
        return true;
    }

    public static Boolean getPersonDataBigHead(Context mContext, RequestQueue mQueue,
                                               Response.Listener<String> onSuccess, Response.ErrorListener onError, String uid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UID, uid));
        paramsList.add(new BcyPair(HttpUtils.FACE, "f"));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                UserApi.getDetail(), mContext, params);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                UserApi.getDetail(), params, onSuccess, errorProxy);
        mQueue.add(getFrontRequest);
        return true;
    }


    public static Boolean getDetailData(Context mContext, RequestQueue mQueue,
                                        Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = "";
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.CPID, mDetailType.getCp_id()));
                url = HttpUtils.BASE_URL + CoserApi.getDetail();
                break;
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.DPID, mDetailType.getDp_id()));
                url = HttpUtils.BASE_URL + IllustApi.getDetail();
                break;
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                paramsList.add(new BcyPair(HttpUtils.UDID, mDetailType.getUd_id()));
                url = HttpUtils.BASE_URL + DailyApi.getDetail();
                break;
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                paramsList.add(new BcyPair(HttpUtils.GID, mDetailType.getGid()));
                paramsList.add(new BcyPair(HttpUtils.POSTID, mDetailType.getPost_id()));
                url = HttpUtils.BASE_URL + GroupApi.getPostdetail();

                break;
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.WPID, mDetailType.getWp_id()));
                url = HttpUtils.BASE_URL + NovelApi.getDetail();
                break;
            default:
                break;
        }
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, url, mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean getMessageData(Context mContext, RequestQueue mQueue,
                                         Response.Listener<String> onSuccess, Response.ErrorListener onError) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        HashMap<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getLastRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                MessageApi.getNoticecount(), map, onSuccess, onError);
        mQueue.add(getLastRequest);
        return true;
    }

    public static Boolean doFollow(Context mContext, RequestQueue mQueue,
                                   Response.Listener<String> onSuccess, Response.ErrorListener onError, String uid, String type) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UID, uid));
        paramsList.add(new BcyPair(HttpUtils.TYPE, type));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                UserApi.getFollow(), params, onSuccess, onError);
        mQueue.add(getFrontRequest);
        return true;
    }


    public static Boolean getCommentData(Context mContext, RequestQueue mQueue,
                                         Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType, int pagenum) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = "";
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.CPID, mDetailType.getCp_id()));
                url = HttpUtils.BASE_URL + CoserApi.getGetreply();
                break;
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.DPID, mDetailType.getDp_id()));
                url = HttpUtils.BASE_URL + IllustApi.getGetreply();
                break;
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                paramsList.add(new BcyPair(HttpUtils.UDID, mDetailType.getUd_id()));
                url = HttpUtils.BASE_URL + DailyApi.getGetreply();
                break;
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                paramsList.add(new BcyPair(HttpUtils.POSTID, mDetailType.getPost_id()));
                url = HttpUtils.BASE_URL + GroupApi.getGetreply();
                break;
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mDetailType.getRp_id()));
                paramsList.add(new BcyPair(HttpUtils.WPID, mDetailType.getWp_id()));
                url = HttpUtils.BASE_URL + NovelApi.getGetreply();
                break;
            default:
                break;
        }
        paramsList.add(new BcyPair(HttpUtils.INDEX_P, pagenum + ""));
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, url, mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLogOut(Context mContext, RequestQueue mQueue,
                                   Response.Listener<String> onSuccess, Response.ErrorListener onError) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = HttpUtils.BASE_URL + UserApi.getLogout();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        Map<String, String> map = HttpUtils.getData(paramsList);

        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean getTeamInfo(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, String mGid) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = HttpUtils.BASE_URL + GroupApi.getDetail();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.GID, mGid));
        Map<String, String> map = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, url, mContext, map);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, errorProxy);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doTeamFollow(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String mGid) {

        String url = HttpUtils.BASE_URL + GroupApi.getSetfocus();
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.GID, mGid));
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doTeamCancel(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String mGid) {
        String url = HttpUtils.BASE_URL + GroupApi.getUnfocus();
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.GID, mGid));
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean delPost(Context mContext, RequestQueue mQueue,
                                  Response.Listener<String> onSuccess, Response.ErrorListener onError, Timeline mTimeline) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = "";
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        switch (mTimeline.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                paramsList.add(new BcyPair(HttpUtils.UDID, mTimeline.getUd_id()));
                url = HttpUtils.BASE_URL + DailyApi.getDeletepost();
                break;
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                paramsList.add(new BcyPair(HttpUtils.POSTID, mTimeline.getPost_id()));
                url = HttpUtils.BASE_URL + GroupApi.getDelpost();
                break;
            case TimelineFactory.TIMELINE_TYPE_COSER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mTimeline.getRp_id()));
                url = HttpUtils.BASE_URL + CoserApi.getDeletecos();
                break;
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                paramsList.add(new BcyPair(HttpUtils.RPID, mTimeline.getRp_id()));
                url = HttpUtils.BASE_URL + IllustApi.getDeleteillust();
                break;
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                paramsList.add(new BcyPair(HttpUtils.RPID, mTimeline.getRp_id()));
                url = HttpUtils.BASE_URL + NovelApi.getDeletenovel();
                break;
        }
        Map<String, String> map = HttpUtils.getData(paramsList);

        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean delPost(Context mContext, RequestQueue mQueue,
                                  Response.Listener<String> onSuccess, Response.ErrorListener onError, Complex complex) {
        Timeline timeline = new Timeline();
        timeline.setTimelineType(complex.getTimelineType());
        timeline.setRp_id(complex.getRp_id());
        timeline.setUd_id(complex.getUd_id());
        timeline.setPost_id(complex.getPost_id());
        return delPost(mContext, mQueue, onSuccess, onError, timeline);
    }

    public static Boolean delSerise(Context mContext, RequestQueue mQueue,
                                    Response.Listener<String> onSuccess, Response.ErrorListener onError, String wns_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        String url = HttpUtils.BASE_URL + NovelApi.getDeleteNovelSet();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.WNS_ID, wns_id));
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLike(Context mContext, RequestQueue mQueue,
                                 Response.Listener<String> onSuccess, Response.ErrorListener onError, Timeline mTimeLine) {

        switch (TimelineFactory.whichType(mTimeLine)) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return doLikeCoser(mContext, mQueue, onSuccess, onError, mTimeLine.getRp_id(), mTimeLine.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return doLikeIllust(mContext, mQueue, onSuccess, onError, mTimeLine.getRp_id(), mTimeLine.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return doLikeDaily(mContext, mQueue, onSuccess, onError, mTimeLine.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return doLikeAsk(mContext, mQueue, onSuccess, onError, mTimeLine.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return doLikeGroup(mContext, mQueue, onSuccess, onError, mTimeLine.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return doLikeGoods(mContext, mQueue, onSuccess, onError, mTimeLine.getZg_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return doLikeWriter(mContext, mQueue, onSuccess, onError, mTimeLine.getRp_id(), mTimeLine.getWp_id());
        }
        return false;
    }

    public static Boolean doLike(Context mContext, RequestQueue mQueue,
                                 Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType) {
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return doLikeCoser(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return doLikeIllust(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return doLikeDaily(mContext, mQueue, onSuccess, onError, mDetailType.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return doLikeAsk(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return doLikeGroup(mContext, mQueue, onSuccess, onError, mDetailType.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return doLikeGoods(mContext, mQueue, onSuccess, onError, mDetailType.getZg_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return doLikeWriter(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getWp_id());
        }
        return false;
    }

    public static Boolean doLikeCoser(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String cpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.CPID, cpid));
        String url = HttpUtils.BASE_URL + CoserApi.getDozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLikeIllust(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String dpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.DPID, dpid));
        String url = HttpUtils.BASE_URL + IllustApi.getDozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLikeWriter(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String wpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.WPID, wpid));
        String url = HttpUtils.BASE_URL + NovelApi.getDozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean doLikeDaily(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, String ud_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UDID, ud_id));
        String url = HttpUtils.BASE_URL + DailyApi.getDopostding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLikeGroup(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, String post_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.POSTID, post_id));
        String url = HttpUtils.BASE_URL + GroupApi.getDoding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLikeAsk(Context mContext, RequestQueue mQueue,
                                    Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id) {

        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UAID, rp_id));
        String url = HttpUtils.BASE_URL + AskApi.getDoding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doLikeGoods(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, String zg_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.ZGID, zg_id));
        String url = HttpUtils.BASE_URL + ZhipinApi.getDoPostDing();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean dislike(Context mContext, RequestQueue mQueue,
                                  Response.Listener<String> onSuccess, Response.ErrorListener onError, Timeline timeline) {

        switch (TimelineFactory.whichType(timeline)) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return disLikeCoser(mContext, mQueue, onSuccess, onError, timeline.getRp_id(), timeline.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return disLikeIllust(mContext, mQueue, onSuccess, onError, timeline.getRp_id(), timeline.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return disLikeDaily(mContext, mQueue, onSuccess, onError, timeline.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return disLikeAsk(mContext, mQueue, onSuccess, onError, timeline.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return disLikeGroup(mContext, mQueue, onSuccess, onError, timeline.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return disLikeGoods(mContext, mQueue, onSuccess, onError, timeline.getZg_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return disLikeWriter(mContext, mQueue, onSuccess, onError, timeline.getRp_id(), timeline.getWp_id());
        }
        return false;
    }

    public static Boolean dislike(Context mContext, RequestQueue mQueue,
                                  Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType) {
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return disLikeCoser(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return disLikeIllust(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return disLikeDaily(mContext, mQueue, onSuccess, onError, mDetailType.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return disLikeAsk(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return disLikeGroup(mContext, mQueue, onSuccess, onError, mDetailType.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return disLikeWriter(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getWp_id());
        }
        return false;
    }

    public static Boolean disLikeCoser(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String cpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.CPID, cpid));
        String url = HttpUtils.BASE_URL + CoserApi.getUndozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disLikeIllust(Context mContext, RequestQueue mQueue,
                                        Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String dpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.DPID, dpid));
        String url = HttpUtils.BASE_URL + IllustApi.getUndozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disLikeWriter(Context mContext, RequestQueue mQueue,
                                        Response.Listener<String> onSuccess, Response.ErrorListener onError, String rpid, String wpid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rpid));
        paramsList.add(new BcyPair(HttpUtils.WPID, wpid));
        String url = HttpUtils.BASE_URL + NovelApi.getUndozan();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean disLikeDaily(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String ud_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UDID, ud_id));
        String url = HttpUtils.BASE_URL + DailyApi.getUndopostding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disLikeGroup(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String post_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.POSTID, post_id));
        String url = HttpUtils.BASE_URL + GroupApi.getUndoding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disLikeAsk(Context mContext, RequestQueue mQueue,
                                     Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UAID, rp_id));
        String url = HttpUtils.BASE_URL + AskApi.getUndoding();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disLikeGoods(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, String zg_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.ZGID, zg_id));
        String url = HttpUtils.BASE_URL + ZhipinApi.getUnDoPostDing();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean doRecommendAll(Context mContext, RequestQueue mQueue,
                                         Response.Listener<String> onSuccess, Response.ErrorListener onError, String uids) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.FOLLOW_UIDS, uids));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                UserApi.getFollowall(), params, onSuccess, onError);
        mQueue.add(getFrontRequest);
        return true;
    }

    public static Boolean doRecommend(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, Timeline mTimeline) {
        switch (TimelineFactory.whichType(mTimeline)) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return doRecommendCoser(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return doRecommendIlluset(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return doRecommendDaily(mContext, mQueue, onSuccess, onError, mTimeline.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return doRecommendAsk(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return doRecommendGroup(mContext, mQueue, onSuccess, onError, mTimeline.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return doRecommendWriter(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getWp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP_TEAM:
                return doRecommendGroupTeam(mContext, mQueue, onSuccess, onError, mTimeline.getGid());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return doRecommendGoods(mContext, mQueue, onSuccess, onError, mTimeline.getZg_id());
        }
        return false;
    }


    public static Boolean doRecommend(Context mContext, RequestQueue mQueue,
                                      Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType) {
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return doRecommendCoser(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return doRecommendIlluset(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return doRecommendDaily(mContext, mQueue, onSuccess, onError, mDetailType.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return doRecommendAsk(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return doRecommendGroup(mContext, mQueue, onSuccess, onError, mDetailType.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return doRecommendGoods(mContext, mQueue, onSuccess, onError, mDetailType.getZg_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return doRecommendWriter(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getWp_id());

        }
        return false;
    }


    public static Boolean doRecommendCoser(Context mContext, RequestQueue mQueue,
                                           Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String cp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.CPID, cp_id));
        String url = HttpUtils.BASE_URL + CoserApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean doRecommendIlluset(Context mContext, RequestQueue mQueue,
                                             Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String dp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.DPID, dp_id));
        String url = HttpUtils.BASE_URL + IllustApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean doRecommendWriter(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String wp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.WPID, wp_id));
        String url = HttpUtils.BASE_URL + NovelApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doRecommendGoods(Context mContext, RequestQueue mQueue,
                                           Response.Listener<String> onSuccess, Response.ErrorListener onError, String zgid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.ZGID, zgid));
        String url = HttpUtils.BASE_URL + ZhipinApi.getDoTuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doRecommendGroupTeam(Context mContext, RequestQueue mQueue,
                                               Response.Listener<String> onSuccess, Response.ErrorListener onError, String gid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.GID, gid));
        String url = HttpUtils.BASE_URL + GroupApi.getDogrouptuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doRecommendDaily(Context mContext, RequestQueue mQueue,
                                           Response.Listener<String> onSuccess, Response.ErrorListener onError, String ud_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UDID, ud_id));
        String url = HttpUtils.BASE_URL + DailyApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean doRecommendGroup(Context mContext, RequestQueue mQueue,
                                           Response.Listener<String> onSuccess, Response.ErrorListener onError, String post_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.POSTID, post_id));
        String url = HttpUtils.BASE_URL + GroupApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean doRecommendAsk(Context mContext, RequestQueue mQueue,
                                         Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UAID, rp_id));
        String url = HttpUtils.BASE_URL + AskApi.getDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disRecommend(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, Timeline mTimeline) {
        switch (TimelineFactory.whichType(mTimeline)) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return disRecommendCoser(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return disRecommendIlluset(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return disRecommendDaily(mContext, mQueue, onSuccess, onError, mTimeline.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return disRecommendAsk(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return disRecommendGroup(mContext, mQueue, onSuccess, onError, mTimeline.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return disRecommendWriter(mContext, mQueue, onSuccess, onError, mTimeline.getRp_id(), mTimeline.getWp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP_TEAM:
                return disRecommendGroupTeam(mContext, mQueue, onSuccess, onError, mTimeline.getGid());
            case TimelineFactory.TIMELINE_TYPE_GOODS:
                return disRecommendGoods(mContext, mQueue, onSuccess, onError, mTimeline.getZg_id());
        }
        return false;
    }


    public static Boolean disRecommend(Context mContext, RequestQueue mQueue,
                                       Response.Listener<String> onSuccess, Response.ErrorListener onError, DetailType mDetailType) {
        switch (mDetailType.getTimelineType()) {
            case TimelineFactory.TIMELINE_TYPE_COSER:
                return disRecommendCoser(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getCp_id());
            case TimelineFactory.TIMELINE_TYPE_ILLUST:
                return disRecommendIlluset(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getDp_id());
            case TimelineFactory.TIMELINE_TYPE_DAILY:
                return disRecommendDaily(mContext, mQueue, onSuccess, onError, mDetailType.getUd_id());
            case TimelineFactory.TIMELINE_TYPE_ASK:
                return disRecommendAsk(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id());
            case TimelineFactory.TIMELINE_TYPE_GROUP:
                return disRecommendGroup(mContext, mQueue, onSuccess, onError, mDetailType.getPost_id());
            case TimelineFactory.TIMELINE_TYPE_WRITER:
                return disRecommendWriter(mContext, mQueue, onSuccess, onError, mDetailType.getRp_id(), mDetailType.getWp_id());
        }
        return false;
    }

    public static Boolean disRecommendGoods(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError, String zg_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.ZGID, zg_id));
        String url = HttpUtils.BASE_URL + ZhipinApi.getUnDoTuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disRecommendCoser(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String cp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.CPID, cp_id));
        String url = HttpUtils.BASE_URL + CoserApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean disRecommendIlluset(Context mContext, RequestQueue mQueue,
                                              Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String dp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.DPID, dp_id));
        String url = HttpUtils.BASE_URL + IllustApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean disRecommendWriter(Context mContext, RequestQueue mQueue,
                                             Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id, String wp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.RPID, rp_id));
        paramsList.add(new BcyPair(HttpUtils.WPID, wp_id));
        String url = HttpUtils.BASE_URL + NovelApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disRecommendGroupTeam(Context mContext, RequestQueue mQueue,
                                                Response.Listener<String> onSuccess, Response.ErrorListener onError, String gid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.GID, gid));
        String url = HttpUtils.BASE_URL + GroupApi.getUnDogrouptuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disRecommendDaily(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError, String ud_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UDID, ud_id));
        String url = HttpUtils.BASE_URL + DailyApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }

    public static Boolean disRecommendGroup(Context mContext, RequestQueue mQueue,
                                            Response.Listener<String> onSuccess, Response.ErrorListener onError, String post_id) {

        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.POSTID, post_id));
        String url = HttpUtils.BASE_URL + GroupApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static Boolean disRecommendAsk(Context mContext, RequestQueue mQueue,
                                          Response.Listener<String> onSuccess, Response.ErrorListener onError, String rp_id) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UAID, rp_id));
        String url = HttpUtils.BASE_URL + AskApi.getUnDotuijian();
        Map<String, String> map = HttpUtils.getData(paramsList);
        StringRequestParam getUserdataRequest = new StringRequestParam(Method.POST, url, map, onSuccess, onError);
        mQueue.add(getUserdataRequest);
        return true;
    }


    public static boolean getNewTimeLine(Context mContext, RequestQueue mQueue,
                                         Response.Listener<String> onSuccess, Response.ErrorListener onError,
                                         String token, String since) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(token)) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, token));
        }
        paramsList.add(new BcyPair(HttpUtils.UPPULL_SINCE, since));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                TimelineApi.getHomeData(), mContext, params);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                TimelineApi.getHomeData(), params, onSuccess, errorProxy);
        mQueue.add(getFrontRequest);
        return true;
    }

    public static boolean getFirstTimeLine(Context mContext, RequestQueue mQueue,
                                           Response.Listener<String> onSuccess, Response.ErrorListener onError,
                                           String token, String since, String score) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(token)) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, token));
        }
        paramsList.add(new BcyPair(HttpUtils.UPPULL_SINCE, since));
        paramsList.add(new BcyPair("score", score));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        OnErrorProxy errorProxy = new OnErrorProxy(onError, onSuccess, HttpUtils.BASE_URL +
                TimelineApi.getHomenew(), mContext, params);
        StringRequestParam getFrontRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                TimelineApi.getHomenew(), params, onSuccess, errorProxy);
        mQueue.add(getFrontRequest);
        return true;
    }


    public static boolean removeFans(Context mContext, RequestQueue mQueue, Response.Listener<String> onSucc, Response.ErrorListener onError, String uid) {
        List<BcyPair> paramsList = new ArrayList<>();
        if (!TextUtils.isEmpty(UserDataHelper.getInstance(mContext).getToken())) {
            paramsList.add(new BcyPair(HttpUtils.TOKEN, UserDataHelper.getInstance(mContext).getToken()));
        }
        paramsList.add(new BcyPair(HttpUtils.UID, uid));
        HashMap<String, String> params = HttpUtils.getData(paramsList);
        StringRequestParam stringRequest = new StringRequestParam(Method.POST, HttpUtils.BASE_URL +
                UserApi.removeFans(), params, onSucc, onError);
        mQueue.add(stringRequest);
        return true;
    }
}